{template 'common'}

{php load()->func('tpl')}

<input type="hidden" name="reply_id" value="{$reply['id']}" />

<div class="panel panel-default">

    <div class="panel-heading">

        活动设置

    </div>

    <div class="panel-body">

		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">使用期限</label>
			<div class="col-sm-8">
				{php echo tpl_form_field_daterange('datelimit', array('starttime'=>date('Y-m-d',$reply['starttime']),'endtime'=>date('Y-m-d',$reply['endtime'])), '')}
			</div>
		</div>

        <div class="form-group">

            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 游戏名称</label>

            <div class="col-sm-9 col-xs-12">

               	<input type="text" id="title" class="form-control" placeholder="" name="title" value="{$reply['title']}">

            </div>

        </div>

		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">达到多少分有抽奖机会</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="score"
					   value="{$reply['score']}" />
			</div>
		</div>
                <div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">分数异常值</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="abnormal" value="{if !empty($reply['abnormal'])}{$reply['abnormal']}{else}0{/if}" />
                                <span class="help-block">大于此值的分数就会自动启动异常处理，如果不设置或者设置为0则不做任何异常处理</span>
			</div>
		</div>
                <div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">异常处理</label>
			<div class="col-sm-8">
				<label class="radio-inline">
                                    <input type="radio" name="abnormalManage" value="0" {if $reply['abnormal_manage']==0 || empty($reply['abnormal_manage'])}checked{/if}>仅记录异常，不做任何处理
                                </label>
				<label class="radio-inline">
                                    <input type="radio" name="abnormalManage" value="1" {if $reply['abnormal_manage']==1}checked{/if}>禁止该条记录
                                </label>
				<label class="radio-inline">
                                    <input type="radio" name="abnormalManage" value="2" {if $reply['abnormal_manage']==2}checked{/if}>封杀此产生异常的用户
                                </label>
                                <span class="help-block">发现异常后，自动进行处理<br/>
                                    禁止该条记录：排行榜不显示异常记录，用户仍旧能够进行抽奖，也能够中奖<br/>
                                    封杀此产生异常的用户：该用户所产生的所有记录都会标记为异常，用户仍旧能够进行抽奖，但是永远都不可能再中奖（异常产生前的正常记录不会改变）
                                </span>
			</div>
		</div>

		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">回复标题</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="r_title"
					   value="{$reply['r_title']}" />
			</div>
		</div>

		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">回复说明</label>
			<div class="col-sm-8">
			<input type="text" name="success_stitle" class="form-control" value="{$reply['reply']}" />
			</div>
		</div>

 		<div class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 control-label">回复图片</label>
		<div class="col-sm-8">
			{php echo tpl_form_field_image('img_url', $reply['img_url'])}
		</div>
	</div>


</div>

<div class="panel panel-default">

    <div class="panel-heading">

        活动详细设置

    </div>

    <div class="panel-body">

        <div class="form-group">

            <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 奖品设置</label>

            <div class="col-sm-9 col-xs-12">

				<div class="panel panel-default">

               	<div class="panel-body table-responsive">

						<table class='table'>

							<thead>

								<tr>

									<th>奖品类别(10字以内)</th>

									<th>奖品名称(50字以内)</th>

									<th>奖品数量</th>

                                    <th>中奖概率(%)</th>

								</tr>

							</thead>

							<tbody id="re-items">

							<tr id='c_one'>

								<td><input id="c_type_one" name="c_type_one" type="text" class="form-control" value="{$reply['c_type_one']}" maxlength="10" placeholder='例如:一等奖' style="width:100px;"/></td>

								<td><input id="c_name_one" name="c_name_one" type="text" class="form-control" value="{$reply['c_name_one']}"  maxlength="50"/></td>

								<td><input id="c_num_one"  name="c_num_one" type="text" class="form-control" value="{$reply['c_num_one']}" /></td>

								<td><input id="c_rate_one"  name="c_rate_one" type="text" class="form-control" value="{$reply['c_rate_one']}" /></td>

							</tr>

							<tr id='c_two'>

								<td><input id="c_type_two" name="c_type_two" type="text" class="form-control" value="{$reply['c_type_two']}" placeholder='例如:二等奖' maxlength="10" style="width:100px;"/></td>

								<td><input id="c_name_two" name="c_name_two" type="text" class="form-control" value="{$reply['c_name_two']}"  maxlength="50"/></td>

								<td><input id="c_num_two"  name="c_num_two" type="text" class="form-control" value="{$reply['c_num_two']}"/></td>

								<td><input id="c_rate_two"  name="c_rate_two" type="text" class="form-control" value="{$reply['c_rate_two']}" /></td>

							</tr>

							<tr id='c_three'>

								<td><input id="c_type_three" name="c_type_three" type="text" class="form-control" value="{$reply['c_type_three']}" maxlength="10" placeholder='例如:三等奖' style="width:100px;"/></td>

								<td><input id="c_name_three" name="c_name_three" type="text" class="form-control" value="{$reply['c_name_three']}"  maxlength="50"/></td>

								<td><input id="c_num_three"  name="c_num_three" type="text" class="form-control" value="{$reply['c_num_three']}"/></td>

								<td><input id="c_rate_three"  name="c_rate_three" type="text" class="form-control" value="{$reply['c_rate_three']}" /></td>

							</tr>

							<tr id='c_four'>

								<td><input id="c_type_four" name="c_type_four" type="text" class="form-control" value="{$reply['c_type_four']}" maxlength="10" placeholder='例如:四等奖' style="width:100px;"/></td>

								<td><input id="c_name_four" name="c_name_four" type="text" class="form-control" value="{$reply['c_name_four']}" maxlength="50"/></td>

								<td><input id="c_num_four"  name="c_num_four" type="text" class="form-control" value="{$reply['c_num_four']}"/></td>

								<td><input id="c_rate_four"  name="c_rate_four" type="text" class="form-control" value="{$reply['c_rate_four']}" /></td>

							</tr>

							<tr id='c_five'>

								<td><input id="c_type_five" name="c_type_five" type="text" class="form-control" value="{$reply['c_type_five']}" placeholder='例如:纪念奖' maxlength="10" style="width:100px;"/></td>

								<td><input id="c_name_five" name="c_name_five" type="text" class="form-control" value="{$reply['c_name_five']}"  maxlength="50"/></td>

								<td><input id="c_num_five"  name="c_num_five" type="text" class="form-control" value="{$reply['c_num_five']}"/></td>

								<td><input id="c_rate_five"  name="c_rate_five" type="text" class="form-control" value="{$reply['c_rate_five']}" /></td>

							</tr>

							<tr id='c_six'>

								<td><input id="c_type_six" name="c_type_six" type="text" class="form-control" value="{$reply['c_type_six']}" placeholder='例如:参与奖' maxlength="10" style="width:100px;"/></td>

								<td><input id="c_name_six" name="c_name_six" type="text" class="form-control" value="{$reply['c_name_six']}" maxlength="50"/></td>

								<td><input id="c_num_six"  name="c_num_six" type="text" class="form-control" value="{$reply['c_num_six']}"/></td>

								<td><input id="c_rate_six"  name="c_rate_six" type="text" class="form-control" value="{$reply['c_rate_six']}" /></td>

							</tr>

							</tbody>

						</table>

					</div>

				</div>

            </div>

        </div>

		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">每天抽奖次数</label>
			<div class="input-group  input-medium">
				<input type="text" name="wnum" id='wnum' class="form-control input-medium" value="{$reply['wnum']}" />
				<span class="input-group-addon">次</span>
			</div>
		</div>

        <div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">虚拟人数</label>
			<div class="input-group  input-medium">
				<input type="text" name="people_num" id='people_num' class="form-control input-medium" value="{$reply['people_num']}" />
				<span class="input-group-addon">人</span>
			</div>
		</div>

		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">每人奖品数量限制</label>
			<div class="input-group  input-medium">
				<input type="text" name="pirzenum" id='pirzenum' class="form-control input-medium" value="{$reply['pirzenum']}" />
				<span class="input-group-addon">个</span>
			</div>
		</div>

		<div class="form-group">
		<label class="col-xs-12 col-sm-3 col-md-2 control-label">重复领奖</label>
			<div class="col-sm-8">
				<label class="radio-inline">
					<input type="radio" name="repeat" value="1" {if $reply['repeat']==1}checked{/if} /> 是
				</label>
				<label class="radio-inline">
					<input type="radio" name="repeat" value="2" {if $reply['repeat']==2}checked{/if} /> 否
				</label>
			</div>
		</div>


		<div class="form-group">
			<label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">主办单位</label>
			<div class="col-sm-8 col-xs-12">
				<textarea name="zcontent" class="form-control richtext" cols="70">{$reply['zcontent']}</textarea>
			</div>
		</div>

		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">活动及兑奖说明</label>
			<div class="col-sm-8 col-xs-12">
				<textarea name="content" class="form-control richtext2" cols="70">{$reply['content']}</textarea>
			</div>
		</div>

</div>

<div class="panel panel-default">
    <div class="panel-heading">
        分享设置
    </div>
	<div class="panel-body">
		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">分享标题</label>
			<div class="col-sm-8">
				<input type="text" class="form-control" name="s_title"
					   value="{$reply['s_title']}" />
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">分享图片</label>
			<div class="col-sm-8">
				{php echo tpl_form_field_image('s_img', $reply['s_img'])}
			</div>
		</div>
		<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">分享描述</label>
				<div class="col-sm-8">
				<input type="text" name="s_content" class="form-control" value="{$reply['s_content']}" />
				</div>
			</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">分享后增加的抽奖次数</label>
			<div class="input-group  input-medium">
				<input type="text" name="addnum" id='addnum' class="form-control input-medium" value="{$reply['addnum']}" />
				<span class="input-group-addon">次</span>
			</div>
		</div>
	</div>

</div>
<div class="panel panel-default">
    <div class="panel-heading">
    关注设置
    </div>
    <div class="panel-body">
		<div class="form-group">
			<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">关注引导页</label>
			<div  class="col-sm-8">
				<input type="text" name="subscribeurl" id='subscribeurl' class="form-control" value="{$reply['subscribeurl']}" />
			</div>
		</div>
	</div>
</div>
        <div class="panel panel-default">
            <div class="panel-heading">
                游戏设置
            </div>
            <div class="panel-body">
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">游戏封面图片</label>
                <div class="col-sm-8">
                    {if !empty($reply['cover_img'])}
                        {php echo tpl_form_field_image('cover_img', $reply['cover_img'])}
                    {else}
                        {php echo tpl_form_field_image('cover_img', "./addons/laoyou_csyx/template/style/homeBg.jpg")}
                    {/if}
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">主人公贴图(上升)</label>
                <div class="col-sm-8">
                    {if !empty($reply['hero_img_up'])}
                        {php echo tpl_form_field_image('hero_img_up', $reply['hero_img_up'])}
                    {else}
                        {php echo tpl_form_field_image('hero_img_up',"./addons/laoyou_csyx/template/style/p1.png")}
                    {/if}
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">主人公贴图(下降)</label>
                <div class="col-sm-8">
                    {if !empty($reply['hero_img_down'])}
                        {php echo tpl_form_field_image('hero_img_down', $reply['hero_img_down'])}
                    {else}
                        {php echo tpl_form_field_image('hero_img_down',"./addons/laoyou_csyx/template/style/p2.png")}
                    {/if}
                </div>
            </div>
            </div>
        </div>

<script language='javascript'>



     $('form').submit(function(){



   if($("#title").isEmpty()){

		Tip.focus("title","请输入活动名称!","right");

		return false;

   }



    if($("#ticket_information").isEmpty()){

		Tip.focus("ticket_information","请输入兑奖信息!","right");

		return false;

   }

   if($("#repeat_lottery_reply").isEmpty()){

		Tip.focus("repeat_lottery_reply","请输入重复抽奖信息!","right");

		return false;

   }



   if($("#c_type_one").isEmpty()){	Tip.focus("c_type_one","请输入奖品类别!","left");	return false;  }

   if($("#c_name_one").isEmpty()){	Tip.focus("c_name_one","请输入奖品名称!","bottom");	return false;  }

   if($("#c_num_one").isEmpty()){	Tip.focus("c_num_one","请输入奖品数量!","right");	return false;  }



     if(!$("#c_type_two").isEmpty()){

         if($("#c_name_two").isEmpty()){	Tip.focus("c_name_two","请输入奖品名称!","left");	return false;  }

         if($("#c_num_two").isEmpty()){	Tip.focus("c_num_two","请输入奖品数量!","right");	return false;  }

     }

     if(!$("#c_type_three").isEmpty()){

         if($("#c_name_three").isEmpty()){	Tip.focus("c_name_three","请输入奖品名称!","left");	return false;  }

         if($("#c_num_three").isEmpty()){	Tip.focus("c_num_three","请输入奖品数量!","right");	return false;  }

     }

     if(!$("#c_type_four").isEmpty()){

         if($("#c_name_four").isEmpty()){	Tip.focus("c_name_four","请输入奖品名称!","left");	return false;  }

         if($("#c_num_four").isEmpty()){	Tip.focus("c_num_four","请输入奖品数量!","right");	return false;  }

     }

     if(!$("#c_type_five").isEmpty()){

         if($("#c_name_five").isEmpty()){	Tip.focus("c_name_five","请输入奖品名称!","left");	return false;  }

         if($("#c_num_five").isEmpty()){	Tip.focus("c_num_five","请输入奖品数量!","right");	return false;  }

     }

     if(!$("#c_type_six").isEmpty()){

         if($("#c_name_six").isEmpty()){	Tip.focus("c_name_six","请输入奖品名称!","left");	return false;  }

         if($("#c_num_six").isEmpty()){	Tip.focus("c_num_six","请输入奖品数量!","right");	return false;  }

     }







     if($("#sn_rename").isEmpty()){

		Tip.focus("sn_rename","请输入SN码重命名!","right");

		return false;

   }

   if($("#tel_rename").isEmpty()){

		Tip.focus("tel_rename","请输入电话重命名!","right");

		return false;

   }

   return true;

});

 function moreItem() {

	 var more = $("#more_item").val();

	 if(more=="0" || more==""){

	    $("#c_four").show();

	    $("#c_five").show();

	    $("#c_six").show();

	 }

	 else{

	    $("#c_four").hide();

	    $("#c_five").hide();

	    $("#c_six").hide();

	 }

	 $("#more_item").val(more=='1'?'0':'1');

}

function doDeleteItemImage(obj,id) {

		var filename = $('input#' + id+"-value").val();

		$('.' + id +"_preview").html("");

		$(obj).html("正在删除...").attr("disabled",true);

 		   ajaxopen('./index.php?act=attachment&do=delete&filename=' + filename, function(){

		   $(obj).html("<i class='icon-upload-alt'></i> 删除").hide().removeAttr("disabled");

		});

	}





    require(['jquery', 'util'], function($, u){

		$(function(){

			u.editor($('.richtext')[0]);
			u.editor($('.richtext2')[0]);

		});

            });



</script>



